﻿<UserControl x:Class="BizControl.Presentation.PeopleModule.Views.PeopleView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cmdsext="clr-namespace:BizControl.Presentation.Infrastructure.Helpers;assembly=BizControl.Presentation.Infrastructure"
             xmlns:controls="clr-namespace:BizControl.Presentation.Infrastructure.Controls;assembly=BizControl.Presentation.Infrastructure">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ToolBar>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Обновить список"
                    Command="{Binding Path=RefreshListCommand}">
                <Button.Content>
                    <Image Source="{DynamicResource refreshImage}" />
                </Button.Content>
            </Button>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Добавить нового пользователя"
                    Command="{Binding Path=AddPersonCommand}"
                    Template="{StaticResource AddButtonTemplate}">
            </Button>
        </ToolBar>
        <DataGrid Grid.Row="2" AutoGenerateColumns="False" ItemsSource="{Binding Path=Model, Mode=OneWay}" 
                  cmdsext:Commands.DataGridDoubleClickCommand="{Binding EditPersonCommand}"
                  SelectedItem="{Binding SelectedPerson}">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Фото">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <controls:CurrentUserControl />
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</UserControl>